package Leetcode.lc026;

/***
 * 删除有序数组的重复项
 */
public class Sloution {
    public int removeDuplicates(int[] nums) {
        int slow=0,fast=0;
        for(;fast<nums.length;fast++){
            if(fast>0 && nums[fast]==nums[fast-1]) continue;
            nums[slow++]=nums[fast];
        }
        return slow;
    }

    public static void main(String[] args) {
        Sloution sloution = new Sloution();
        int[] ints = {1, 1, 2,2,3,5,6};
        int res=sloution.removeDuplicates(ints);
        System.out.print(res);
    }
}
